<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------

namespace app\erp\admin;

use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
/**
 * 商品管理
 * @package app\erp\admin
 */
class GoodsSpecifications extends Admin
{
    /**
     * 首页
     * @author shiqiang
     * @return mixed
     */
    public function index(){	
		cookie('__forward__', $_SERVER['REQUEST_URI']);
		
		$data = input();

		$goods_id = isset($data['goods_id']) ? $data['goods_id'] : 0;
		$map[] = ['goods_id', '=', $goods_id];
		
		$shuxing = [
			'title' => '属性列表',
			'icon'  => 'fa fa-fw fa-key',
			'class' => 'btn btn-xs btn-default',
			'href'  => url('goods_specifications_attribute/index', ['specifications_id' => '__specifications_id__', 'goods_id' => $goods_id]),
		];

		// 数据列表
		$data_list = model('erp/ErpGoodsSpecifications', 'model') -> where($map) -> order('sort asc') -> paginate();
		//dump($data_list);
		// 使用ZBuilder快速创建数据表格
        return ZBuilder::make('table')
            ->setPageTitle('规格列表') // 设置页面标题
            //->setTableName('video_play_class') // 设置数据表名
            ->addColumns([ // 批量添加列
                ['specifications_id', 'id'],
                ['specifications_title', '规格名称','text.edit'],
                ['sort', '排序','text.edit'],
                ['right_button', '操作', 'btn']
            ])
			->setRowList($data_list) // 设置表格数据,
			->addRightButton('shuxing', $shuxing, true) // 批量添加右侧按钮
            ->fetch(); // 渲染页面
    }
	
	
	
}

